package com.fourth.controller;

import com.fourth.service.BusinessService;
import com.ljx.entity.BusinessInfo;
import com.ljx.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author C-Q
 * @version 1.1.0
 * @Description: 商家上线入驻审核
 * @date 2023/2/27
 */
@RestController
@RequestMapping("/merchant")
public class BusinessController {
    @Resource
    private BusinessService businessService;

    /**
     * 分页查询BusinessInfo商家入住审核表数据返回给前端
     * @return
     */
    @RequestMapping("/all")
    public Result selectAll(@RequestParam(defaultValue = "1" ) Integer currentPage,@RequestParam(defaultValue = "1" ) Integer pageSize,@RequestBody BusinessInfo businessInfo){
        return businessService.businessAll(currentPage,pageSize,businessInfo);
    }

    /**
     * 商家入驻审核操作
     * @param businessInfo
     * @return
     */
    @RequestMapping("/statusInfo")
    public Result statusInfo(@RequestBody BusinessInfo businessInfo){
        int i = businessService.updateInfo(businessInfo);
        if(i>0){
            return new Result(2000,"审核成功",i);
        }
        return new Result(5000,"审核失败",i);
    }


}
